<% import grails.persistence.Event %>
<%=packageName%>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="\${message(code: '${domainClass.propertyName}.label', default: '${className}')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<div class="nav" role="navigation">
		
	<ul class="nav nav-pills">
		<g:permissao devePossuir="true" controles="${domainClass.propertyName}" acoes="list">
			<li class="active">
				<g:link class="list" action="list">
					<i class="icon-list-alt"></i>
					<g:message code="default.list.label" args="[entityName]" />
				</g:link>
			</li>
		</g:permissao>
		<li class="divider-vertical"></li>
		<g:permissao devePossuir="true" controles="${domainClass.propertyName}" acoes="list">
			<li>
				<g:link action="create">
					<i class="icon-file"></i>
					<g:message code="default.add.label" args="[entityName]" />
				</g:link>
			</li>
		</g:permissao>
	</ul>


		</div>
		<div id="list-${domainClass.propertyName}" class="content scaffold-list" role="main">
			<legend><g:message code="default.list.label" args="[entityName]" /></legend>
			<mensagem:renderizar mensagem="\${flash}" />
			
			
			
			
	<table class="table table-hover table-condensed table-striped table-blue">
		<thead>
				<tr>
					<th></th>
					<th></th>
					<%  excludedProps = Event.allEvents.toList() << 'id' << 'version'
						allowedNames = domainClass.persistentProperties*.name << 'dateCreated' << 'lastUpdated'
						props = domainClass.properties.findAll { allowedNames.contains(it.name) && !excludedProps.contains(it.name) && it.type != null && !Collection.isAssignableFrom(it.type) }
						Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
						props.eachWithIndex { p, i ->
							if (i < 6) {
								if (p.isAssociation()) { %>
						<th><g:message code="${domainClass.propertyName}.${p.name}.label" default="${p.naturalName}" /></th>
					<%      } else { %>
						<g:sortableColumn property="${p.name}" title="\${message(code: '${domainClass.propertyName}.${p.name}.label', default: '${p.naturalName}')}" />
					<%  }   }   } %>
					</tr>
		
		</thead>
		
		<tbody>
						
			
				<g:each in="\${${propertyName}List}" status="i" var="${propertyName}">
					<tr class="\${(i % 2) == 0 ? 'even' : 'odd'}">
					<%  props.eachWithIndex { p, i ->
							if (i == 0) { %>
						<td><g:link action="show" id="\${${propertyName}.id}"><i class="icon-eye-open"></i></g:link></td>
						<td><g:link action="edit" id="\${${propertyName}.id}"><i class="icon-edit"></i></g:link></td>
						<td><g:link action="show" id="\${${propertyName}.id}">\${fieldValue(bean: ${propertyName}, field: "${p.name}")}</g:link></td>
					<%      } else if (i < 6) {
								if (p.type == Boolean || p.type == boolean) { %>
						<td><g:formatBoolean boolean="\${${propertyName}.${p.name}}" /></td>
					<%          } else if (p.type == Date || p.type == java.sql.Date || p.type == java.sql.Time || p.type == Calendar) { %>
						<td><g:formatDate date="\${${propertyName}.${p.name}}" /></td>
					<%          } else { %>
						<td>\${fieldValue(bean: ${propertyName}, field: "${p.name}")}</td>
					<%  }   }   } %>
					</tr>
				</g:each>
		</tbody>
	</table>

			<div class="paginationGrails">
				<g:paginate total="\${${propertyName}Total}" />
			</div>
			
		</div>
	</body>
</html>
